﻿/*----------------------------------------------------------------
// Copyright (C) 2011 上海
// 版权所有。 
//
// 文件名：DataAccessPasswordModify
// 文件功能描述：修改密码数据访问层
//
// 
// 创建标识：2012-06-21 王冲
//
// 修改标识：
// 修改描述：
//
//
//----------------------------------------------------------------*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DbAdapter.sqldbAdapter;
using System.Data.SqlClient;

namespace DAO.WaiGaoQiao
{
    public class DataAccessPasswordModify
    {
        /// <summary>
        /// 保存密码(修改界面下)
        /// </summary>
        /// <param name="supp"></param>
        /// <returns></returns>
        public int SavePassword(object[] supp)
        {
            sqldb db = new sqldb();
            string query = "update Tbt_LogUser set LogPassword='" + supp[1] + "',LogDt=getdate() where LogName='" + supp[0] + "'";
            int rowcount = db.ExecuteNonQuery(GetConntionString.conntionstring(), CommandType.Text, query);
            return rowcount;
        }
        /// <summary>
        /// 验证旧密码是否正确
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public string CheckPasswordsOld(string name)
        {
            sqldb db = new sqldb();
            string query = "select LogPassword from Tbt_LogUser where LogName='" + name + "'";
            string oldpassword = db.ExecuteScalar(GetConntionString.conntionstring(), CommandType.Text, query).ToString();
            return oldpassword;
        }
    }
}
